package tix.itf

import tix.Version
import java.io.File

/**
 * One version of a package.
 */
trait PackageVersion extends Serializable {
  /** Package name */
  val name: String

  /** Package version ID */
  val version: Version

  /** Workflow followed by this package */
  val workflow: () => PackageWorkflow

  /** Configuration/environment details */
  val config: Map[Symbol, Any]
}

/**
 * Version of an autotools based package.
 */
trait AutotoolsPackageVersion extends PackageVersion {
  def sourceDir(): File
  def buildDir(): File
  def installDir(): File
  val sourcePackage: File
  def configureFlags(): List[String]
}

/**
 * Workflow of a package.
 */
trait PackageWorkflow {
  val pkg: PackageVersion

  /** Install the package version described by pkg */
  def install()

  /** Uninstall the package version described by pkg */
  def remove()
}

/** Concrete workflow of an autotools package. */
trait AutotoolsPackageWorkflow extends PackageWorkflow {
  def setupSource()
  def configure()
  def make()
  def makeInstall()
  def clean()
}